package com.css.bjdt_core.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SqlSplitUtil {
	public static String segmentRegExp(String sql,String ss) {
		String result = "";
		Pattern pattern = Pattern.compile(ss, Pattern.CASE_INSENSITIVE);
		for (int i = 0; i <= sql.length(); i++) {
			String shortSql = sql.substring(0, i);
			// 测试输出的子句是否正确
			//System.out.println(shortSql);
			Matcher matcher = pattern.matcher(shortSql);
			while (matcher.find()) {
				result = matcher.group(2);
				break;
			}
		}
		return result;
	}
}
